using System;
using System.Collections.Generic;

namespace VOL.Entity.DomainModels
{
    /// <summary>
    /// 入库单详情DTO（主表+明细表）
    /// </summary>
    public class RukuDetailDto
    {
        /// <summary>
        /// 入库单主表ID
        /// </summary>
        public long Id { get; set; }

        /// <summary>
        /// 入库单号
        /// </summary>
        public string StockInCode { get; set; }

        /// <summary>
        /// 仓库ID
        /// </summary>
        public long? WarehouseId { get; set; }

        /// <summary>
        /// 仓库名称
        /// </summary>
        public string WarehouseName { get; set; }

        /// <summary>
        /// 入库日期
        /// </summary>
        public DateTime? StockInDate { get; set; }

        /// <summary>
        /// 关联单号
        /// </summary>
        public string RelatedOrderCode { get; set; }

        /// <summary>
        /// 供应商ID
        /// </summary>
        public long? SupplierId { get; set; }

        /// <summary>
        /// 供应商名称
        /// </summary>
        public string SupplierName { get; set; }

        /// <summary>
        /// 联系人
        /// </summary>
        public string ContactPerson { get; set; }

        /// <summary>
        /// 联系方式
        /// </summary>
        public string ContactPhone { get; set; }

        /// <summary>
        /// 经办人ID
        /// </summary>
        public int? UserId { get; set; }

        /// <summary>
        /// 经办人姓名
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// 单据状态
        /// </summary>
        public int? Status { get; set; }

        /// <summary>
        /// 单据状态名称
        /// </summary>
        public string StatusName { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        /// 审核人
        /// </summary>
        public string AuditUser { get; set; }

        /// <summary>
        /// 审核时间
        /// </summary>
        public DateTime? AuditTime { get; set; }

        /// <summary>
        /// 入库类型ID
        /// </summary>
        public long? InOutTypeId { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        public string Creator { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreateDate { get; set; }

        /// <summary>
        /// 修改人
        /// </summary>
        public string Modifier { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        public DateTime? ModifyDate { get; set; }

        /// <summary>
        /// 入库总数量（从明细表统计）
        /// </summary>
        public int? TotalQuantity { get; set; }

        /// <summary>
        /// 入库总金额（从明细表统计）
        /// </summary>
        public decimal? TotalAmount { get; set; }

        /// <summary>
        /// 入库明细列表
        /// </summary>
        public List<RukuItemDto> Items { get; set; }
    }

    /// <summary>
    /// 入库单明细DTO
    /// </summary>
    public class RukuItemDto
    {
        /// <summary>
        /// 明细ID
        /// </summary>
        public long Id { get; set; }

        /// <summary>
        /// 入库单ID
        /// </summary>
        public long? StockInOrderId { get; set; }

        /// <summary>
        /// 入库单号
        /// </summary>
        public string StockInCode { get; set; }

        /// <summary>
        /// 货品ID
        /// </summary>
        public long GoodsId { get; set; }

        /// <summary>
        /// 货品编号
        /// </summary>
        public string GoodsCode { get; set; }

        /// <summary>
        /// 货品名称
        /// </summary>
        public string GoodsName { get; set; }

        /// <summary>
        /// 规格型号
        /// </summary>
        public string SpecModel { get; set; }

        /// <summary>
        /// 单位ID
        /// </summary>
        public long? UnitId { get; set; }

        /// <summary>
        /// 单位名称
        /// </summary>
        public string UnitName { get; set; }

        /// <summary>
        /// 货品类型ID
        /// </summary>
        public long? GoodsTypeId { get; set; }

        /// <summary>
        /// 货品类型名称
        /// </summary>
        public string GoodsTypeName { get; set; }

        /// <summary>
        /// 当前库存
        /// </summary>
        public long? CurrentInventory { get; set; }

        /// <summary>
        /// 进货数量
        /// </summary>
        public int? PurchaseQuantity { get; set; }

        /// <summary>
        /// 已入库数量
        /// </summary>
        public int? InStockedQuantity { get; set; }

        /// <summary>
        /// 未入库数量
        /// </summary>
        public int? UnStockedQuantity { get; set; }

        /// <summary>
        /// 本次入库数量
        /// </summary>
        public int? ThisTimeQuantity { get; set; }

        /// <summary>
        /// 入库库位ID
        /// </summary>
        public long? StockPosition { get; set; }

        /// <summary>
        /// 库位名称
        /// </summary>
        public string StockPositionName { get; set; }

        /// <summary>
        /// 进货单价
        /// </summary>
        public int? PurchasePrice { get; set; }

        /// <summary>
        /// 本次入库金额
        /// </summary>
        public string Upprice { get; set; }

        /// <summary>
        /// 批次号
        /// </summary>
        public string BatchNo { get; set; }

        /// <summary>
        /// 生产日期
        /// </summary>
        public DateTime? ProductionDate { get; set; }

        /// <summary>
        /// 过期日期
        /// </summary>
        public DateTime? ExpireDate { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
    }

    /// <summary>
    /// 入库单列表查询参数
    /// </summary>
    public class RukuQueryDto
    {
        /// <summary>
        /// 页码
        /// </summary>
        public int PageIndex { get; set; } = 1;

        /// <summary>
        /// 每页记录数
        /// </summary>
        public int PageSize { get; set; } = 20;

        /// <summary>
        /// 入库单号
        /// </summary>
        public string StockInCode { get; set; }

        /// <summary>
        /// 仓库ID
        /// </summary>
        public long? WarehouseId { get; set; }

        /// <summary>
        /// 供应商ID
        /// </summary>
        public long? SupplierId { get; set; }

        /// <summary>
        /// 单据状态
        /// </summary>
        public int? Status { get; set; }

        /// <summary>
        /// 开始日期
        /// </summary>
        public DateTime? StartDate { get; set; }

        /// <summary>
        /// 结束日期
        /// </summary>
        public DateTime? EndDate { get; set; }

        /// <summary>
        /// 关键词（搜索单号、联系人等）
        /// </summary>
        public string Keyword { get; set; }
    }

    /// <summary>
    /// 入库明细查询参数
    /// </summary>
    public class RukuItemQueryDto
    {
        /// <summary>
        /// 页码
        /// </summary>
        public int PageIndex { get; set; } = 1;

        /// <summary>
        /// 每页记录数
        /// </summary>
        public int PageSize { get; set; } = 20;

        /// <summary>
        /// 入库单ID
        /// </summary>
        public long? StockInOrderId { get; set; }

        /// <summary>
        /// 入库单号
        /// </summary>
        public string StockInCode { get; set; }

        /// <summary>
        /// 货品ID
        /// </summary>
        public long? GoodsId { get; set; }

        /// <summary>
        /// 货品编号
        /// </summary>
        public string GoodsCode { get; set; }

        /// <summary>
        /// 货品名称
        /// </summary>
        public string GoodsName { get; set; }

        /// <summary>
        /// 批次号
        /// </summary>
        public string BatchNo { get; set; }

        /// <summary>
        /// 库位ID
        /// </summary>
        public long? StockPosition { get; set; }

        /// <summary>
        /// 开始日期
        /// </summary>
        public DateTime? StartDate { get; set; }

        /// <summary>
        /// 结束日期
        /// </summary>
        public DateTime? EndDate { get; set; }

        /// <summary>
        /// 关键词（搜索货品编号、货品名称、批次号等）
        /// </summary>
        public string Keyword { get; set; }
    }
}

